package com.zndroid.gridview.preview.indicator;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * 预览导航器接口，可以自定义任意导航的实现方式
 * @author lzy
 */
public interface IIndicator {
    /**居中*/
    byte CENTER = 0b0;
    /**靠右居中*/
    byte CENTER_RIGHT = 0b1;
    /**右上角*/
    byte RIGHT_TOP = 0b10;
    /**靠上居中*/
    byte CENTER_TOP = 0b11;
    /**左上角*/
    byte LEFT_TOP = 0b100;
    /**靠左居中*/
    byte CENTER_LEFT = 0b11111111111111111111111111111111;
    /**左下角*/
    byte LEFT_BOTTOM = 0b11111111111111111111111111111110;
    /**靠底部居中*/
    byte CENTER_BOTTOM = 0b11111111111111111111111111111101;
    /**右下角*/
    byte RIGHT_BOTTOM = 0b11111111111111111111111111111100;

    /**
     * 提供自定义导航控件
     *
     * @param layoutInflater layoutInflater
     * @param root rootView
     * @return View indicatorView
     * */
    View bindView(LayoutInflater layoutInflater, ViewGroup root);
    /**
     * 当前选中项
     *
     * @param indicatorView current indicatorView
     * @param position index
     * @param total count
     * */
    void onIndex(View indicatorView, int position, int total);

    /**
     * the left margin size
     * unit:dp
     *
     * @return left
     * */
    int left();
    /**
     * the top margin size
     * unit:dp
     *
     * @return top
     * */
    int top();
    /**
     * the right margin size
     * unit:dp
     *
     * @return right
     * */
    int right();
    /**
     * the bottom margin size
     * unit:dp
     *
     * @return bottom
     * */
    int bottom();

    /**
     * a layout rule to be interpreted by the RelativeLayout
     * @return gravity
     * */
    default int gravity() {return CENTER_BOTTOM;}
}
